/**
 * Created by h p on 2016/3/13.
 */
public class Bitwise {
    public static void main(String[] args){
        System.out.println("AND运算：");
        System.out.printf("0 AND 0 %5d%n",0 & 0);
        System.out.printf("0 AND 1 %5d%n",0 & 1);
        System.out.printf("1 AND 0 %5d%n",1 & 0);
        System.out.printf("1 AND 1 %5d%n",1 & 1);

        System.out.printf("\nOR运算：");
        System.out.printf("0 OR 0 %6d%n",0 | 0  );
        System.out.printf("0 OR 1 %6d%n",0 | 1  );
        System.out.printf("1 OR 0 %6d%n",1 | 0  );
        System.out.printf("1 OR 1 %6d%n",1 | 1  );

        System.out.printf("\nXOR运算：");
        System.out.printf("0 XOR 0 %5d%n",0 ^ 0  );
        System.out.printf("0 XOR 1 %5d%n",0 ^ 1  );
        System.out.printf("1 XOR 0 %5d%n",1 ^ 0  );
        System.out.printf("1 XOR 1 %5d%n",1 ^ 1  );
    }
}
